﻿using UnityEngine;
using System.Collections;

public class BossAttackAndDamage : AttackAndDamage {

    private float bossAttack = 120;

    private GameObject player;

    public AudioClip bossAttackAudio; // 声源

    void Awake()
    {
        base.Awake();
        player = GameObject.FindGameObjectWithTag(Tags.player);
    }

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}

    public void BossAttack01Event()
    {
        AudioSource.PlayClipAtPoint(bossAttackAudio, transform.position, 1.0f);  // 播放Clip  1.0为声音大小

        float distance = 0;
        if (player)
        {
            distance = Vector3.Distance(player.transform.position, transform.position);
        }

        if (distance <= base.attackDistance && player)
        {
            player.GetComponent<AttackAndDamage>().TakenDamage(bossAttack);
        }

    }
    public void BossAttack02Event()
    {
        AudioSource.PlayClipAtPoint(bossAttackAudio, transform.position, 1.0f);

        float distance = 0;
        if (player)
        {
            distance = Vector3.Distance(player.transform.position, transform.position);

        }
        if (distance <= base.attackDistance && player)
        {
            player.GetComponent<AttackAndDamage>().TakenDamage(bossAttack);
 
        }
    }
}
